/*
 * @Author: WangShuai 1830773767@qq.com
 * @Date: 2025-10-05 20:00:34
 * @LastEditors: WangShuai 1830773767@qq.com
 * @LastEditTime: 2025-10-06 21:39:55
 * @FilePath: \react_staging\src\components\List\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Item from '../Item'
import './index.css'
export default class List extends Component {
	//对接收的数据类型,必要性进行限制
	static propTypes = {
		todos: PropTypes.array.isRequired,
        updateTodo:PropTypes.func.isRequired,
        deleteTodo:PropTypes.func.isRequired,
	}
	render() {
		const { todos, updateTodo ,deleteTodo} = this.props
		return (
			<ul className="todo-main">
				{todos.map((todo) => {
					return (
						<Item
							todo={todo}
							key={todo.id}
							updateTodo={updateTodo}
                            deleteTodo={deleteTodo}
						></Item>
					)
				})}
			</ul>
		)
	}
}
